package com.scwatch.core.repository;

import com.scwatch.common.orm.Limitable;
import com.scwatch.core.domain.GaoCeng;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.Repository;

import java.util.List;

/**
 * @author mafei
 * @Title: GcDao
 * @ProjectName SCGC_CMS
 * @Description: TODO
 * @date 2018/10/1515:22
 */
public interface GcDao  extends Repository<GaoCeng, Integer> {
    public Page<GaoCeng> findAll(Specification<GaoCeng> spec,
                                 Pageable pageable);

    public List<GaoCeng> findAll(Specification<GaoCeng> spec,
                                Limitable limitable);

    public GaoCeng findOne(Integer id);

    public GaoCeng save(GaoCeng bean);

    public void delete(GaoCeng bean);

    public List<GaoCeng> findByStatus(int status);
    @Modifying
    @Query("update GaoCeng bean set bean.priority=?1 where bean.id=?2 ")
    public void updateOrder(Integer order, Integer id);
}
